﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace _072.EFCore多对多
{
	internal class StudentConfig: IEntityTypeConfiguration<Student>
	{
		public void Configure(EntityTypeBuilder<Student> builder)
		{
			builder.ToTable("T_Students");
			builder.HasMany<Teacher>(s => s.Teachers)
				.WithMany(t => t.Students).
				UsingEntity(j => j.ToTable("T_Students_Teachers"));
		}
	}
}
